package com.gui.design.singleton;

public class SingletonDemo4 {

    public static void main(String[] args) {
        Singleton instance = Singleton.getInstance();
        Singleton instance1 = Singleton.getInstance();
        System.out.println(instance);
        System.out.println(instance1);
    }

}

class Singleton {

    private Singleton() {}

    private static class SingletonFactory {
        public static final Singleton INSTANCE = new Singleton();
    }

    public static Singleton getInstance(){
        return SingletonFactory.INSTANCE;
    }
}
